﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Script.Serialization;

namespace TombMedia.Extensions.JSON
{
    public static class JsonUtility<T>
    {
        public static string Stringify(T value)
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            var serializer = new JavaScriptSerializer();
            serializer.Serialize(value, sb);
            return sb.ToString();
        }
        public static T Convert(string s)
        {
            var serializer = new JavaScriptSerializer();
            T deserializedObject = serializer.Deserialize<T>(s);
            return deserializedObject;
        }
    }
}
